package com.spider.admin.conf;

import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;

@Getter
@Setter
@Accessors(chain = true)
public class CommandExecResult {
    private boolean success = false;
    private String resultMessage;
    private String runMessage;
    private List<String> resultLineMsg = new ArrayList<>();

    public String toString() {
        return (success ? "SUCCESS" : "ERROR") + "\t" + ("\nresult:\t"
                + (StringUtils.isNotEmpty(resultMessage) ? resultMessage : ""))
                + ("\nexec message:\t" + (StringUtils.isNotEmpty(resultMessage) ? resultMessage : ""));
    }
}
